package com.achilles.activity;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;

import com.achilles.playtask.R;

public abstract class ToolBarActivity extends BaseActivity {

    private Toolbar mToolbar;
    private String[] mTitleName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void init() {
        mToolbar = (Toolbar) findViewById(R.id.toolBar);
        if (mToolbar == null) {
            throw new IllegalArgumentException("You must be contain toolbar if you need use " +
                    "ToolBarActivity");
        }
        mToolbar.setTitleTextColor(ContextCompat.getColor(this,android.R.color.white));
        mTitleName = getResources().getStringArray(R.array.titleName);
    }

    protected Toolbar getToolBarView() {
        return mToolbar;
    }

    protected void setTitleName(int index) {
        getToolBarView().setTitle(mTitleName[index]);
    }
}
